Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CheckLimitsForResolvConf to Kubelet#syncLoop #84253

Merged
merged 1 commit into from
Nov 1, 2019

Conversation

tedyu
Copy link
Contributor

@tedyu tedyu commented Oct 23, 2019

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
This PR moves the CheckLimitsForResolvConf to Kubelet#syncLoop.

Which issue(s) this PR fixes:
Fixes #80070

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 23, 2019
@tedyu
Copy link
Contributor Author

tedyu commented Oct 23, 2019

/test pull-kubernetes-node-e2e

Copy link
Contributor

@mattjmcnaughton mattjmcnaughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Makes sense to me to only do this once :)

pkg/kubelet/kubelet.go Show resolved Hide resolved
pkg/kubelet/kubelet.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 23, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 24, 2019
@tedyu
Copy link
Contributor Author

tedyu commented Oct 24, 2019

@mattjmcnaughton
Please take another look.

@tedyu
Copy link
Contributor Author

tedyu commented Oct 24, 2019

/test pull-kubernetes-e2e-gce-100-performance

Copy link
Contributor

@mattjmcnaughton mattjmcnaughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Still looks good to me :)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 24, 2019
@tedyu
Copy link
Contributor Author

tedyu commented Oct 24, 2019

/assign @MrHohn

Copy link
Member

@MrHohn MrHohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks and sorry for the delay.
/lgtm
/approve

@tedyu
Copy link
Contributor Author

tedyu commented Oct 28, 2019

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 28, 2019
@tallclair
Copy link
Member

Is this check just informational, for debugging purposes?

@tedyu
Copy link
Contributor Author

tedyu commented Oct 30, 2019

@tallclair
Since the log is not at error level, I would think so.

@tallclair
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MrHohn, tallclair, tedyu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 31, 2019
@tedyu
Copy link
Contributor Author

tedyu commented Oct 31, 2019

/test pull-kubernetes-integration

@k8s-ci-robot k8s-ci-robot merged commit b1ac4cd into kubernetes:master Nov 1, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Nov 1, 2019
@derekwaynecarr
Copy link
Member

I am not sure this really improved anything.

If network manager is restarted or the kubelet has a race with network manager, its possible the contents of /etc/resolv.conf could change underneath us. I preferred checking the contents of the file in the iteration loop rather than checking it once for the life of the process. It makes changes are harder to debug if/when there are actual problems.

@tedyu
Copy link
Contributor Author

tedyu commented Nov 4, 2019

I am fine with checking /etc/resolv.conf more than once.
I doubt whether the check should be done for every iteration though.
How about checking the contents every hour (open to suggestion on the duration) ?

	if start.Sub(kl.lastResolvConfCheck) > time.Hour {
		if kl.dnsConfigurer != nil && kl.dnsConfigurer.ResolverConfig != "" {
			kl.dnsConfigurer.CheckLimitsForResolvConf()
		}
		kl.lastResolvConfCheck = start
	}

where

	// lastResolvConfCheck records the time of last /etc/resolv.conf check
	lastResolvConfCheck time.Time

@tedyu
Copy link
Contributor Author

tedyu commented Nov 4, 2019

Currently the check logs a warning.
If at T1 the check passes and at T2 (> T1) the check fails, we should log an error.

@derekwaynecarr
Copy link
Member

@tedyu that makes sense.

@tedyu
Copy link
Contributor Author

tedyu commented Nov 4, 2019

Here is skeleton of proposed change for CheckLimitsForResolvConf (showing only one of the 4 klog's):

func (c *Configurer) CheckLimitsForResolvConf(sawGoodResolvConf bool) bool {

...
	_, hostSearch, _, err := parseResolvConf(f)
	if err != nil {
		c.recorder.Event(c.nodeRef, v1.EventTypeWarning, "CheckLimitsForResolvConf", err.Error())
		if sawGoodResolvConf {
			klog.Errorf("CheckLimitsForResolvConf: " + err.Error())
		} else {
			klog.V(4).Infof("CheckLimitsForResolvConf: " + err.Error())
		}
		return false
	}

@derekwaynecarr
If you think the above looks good, I will send out a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid unnecessary check for resolv.conf limit in kubelet
7 participants